package cn.zymall.goods.controller;

import cn.zymall.common.controller.crud.BaseController;
import cn.zymall.common.model.ShoppingCar;
import cn.zymall.goods.service.ShopCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lxh
 * @Description 购物车控制层
 * @date 2020/8/26 15:13
 * @Classname ShopCarController
 **/
@RestController
@RequestMapping("/shopCar")
public class ShopCarController extends BaseController<ShopCarService, ShoppingCar> {

	@Autowired
	private ShopCarService shopCarService;

	/**
	 * 根据用户id查询购物车
	 * @param id
	 * @return
	 */
	@GetMapping("/findMyShoppingCar/{id}")
	public List<ShoppingCar> findMyShoppingCar(@PathVariable(name = "id") Integer id){
		return shopCarService.findMyShoppingCar(id);
	}

}
